<template>
  <view class="crad-container" :style="{ padding }">
    <view class="header" :class="[headerBorder ? 'header-border' : '']">
      <view class="title">
        <text>{{ title }}</text>
        <slot name="title" />
      </view>
      <view v-if="oprationText" class="opration" @click="emits('opration')">
        <text class="text">{{ oprationText }}</text>
        <text class="ali-icon icon-you icon-style"></text>
      </view>
    </view>
    <view class="content">
      <slot></slot>
    </view>
  </view>
</template>
<script setup lang="ts">
  const props = defineProps({
    title: {
      type: String,
      default: '',
    },
    oprationText: {
      type: String,
      default: '',
    },
    headerBorder: {
      type: Boolean,
      default: false,
    },
    padding: {
      type: String,
      default: '32rpx',
    },
  });
  const emits = defineEmits(['opration']);
</script>
<style lang="scss" scoped>
  .crad-container {
    border-radius: 16rpx;
    background: #fff;
    /* 默认卡片投影 */
    box-shadow: 0px 4rpx 24rpx 0px rgba(150, 151, 153, 0.16);
    .header-border {
      border-bottom: 1px solid #ebedf0;
    }
    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .title {
        font-size: 32rpx;
        line-height: 48rpx;
        word-break: break-all;
        color: #333;
        width: 100%;
      }
      .opration {
        display: flex;
        align-items: center;
        gap: 4rpx;
        .text {
          white-space: nowrap;
          color: #999996;
          font-size: 28rpx;
          line-height: 40rpx;
        }
        .icon-style {
          font-size: 32rpx;
          color: #ccccc8;
        }
      }
      margin-bottom: 24rpx;
    }
  }
</style>
